import { Injectable, PipeTransform } from "@nestjs/common";
import { decrypt } from "src/encrypt/encrypt";

/**
 * 解析加密参数
 */
@Injectable()
export class DecodePipe implements PipeTransform {
  transform(value: any) {

    // 该方法在参数校验后触发

    // 解密
    const dataStr = decrypt(value.params)
    const data = JSON.parse(dataStr)

    return data
  }
}